<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Web Solutions
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2007/07/10 08:57:50 $)
// $RCSfile: client_comments.php,v $ : $Revision: 1.5 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================


if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

require_once ("./includes/functions_comments.php");


/**
* ###############################################
* ADD NEW COMMENT
* ###############################################
*/
if ($eventaction == "addcomment")
{
	if (empty($_POST["fullname"]) || empty($_POST["comments"]))
	{
		
	} else {
		insertComment($_POST["commenttype"], $_POST["typeid"], $_POST["fullname"], $_POST["email"], $_POST["comments"]);

		if ($_POST["commenttype"] == COMMENT_KNOWLEDGEBASE)
		{
			if (defined("MODERNBILLV5"))
			{
				echo 'location: faqs.php?action='. getActionID("ShowFAQs") .'&sid='. $CONF["user"]["sessionID"] .'&_m=knowledgebase&_a=viewarticle&kbarticleid=". intval($_POST["typeid"]) ."&commentsuccess=1';
				exit;
				header('location: faqs.php?action='. getActionID("ShowFAQs") .'&sid='. $CONF["user"]["sessionID"] .'&_m=knowledgebase&_a=viewarticle&kbarticleid=". intval($_POST["typeid"]) ."&commentsuccess=1');
			} else {
				header("location: index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=". intval($_POST["typeid"]) ."&commentsuccess=1");
			}
		} else if ($_POST["commenttype"] == COMMENT_TROUBLESHOOTER) {
			$_troubleshootercat = $dbCore->queryFetch("SELECT `troubleshootercatid` FROM `". TABLE_PREFIX ."troubleshootersteps` WHERE `troubleshooterid` = '". intval($_POST["typeid"]) ."';");
			header("location: index.php?_m=troubleshooter&_a=steps&parenttroubleshooterid=". intval($_POST["typeid"]) ."&troubleshootercatid=".intval($_troubleshootercat["troubleshootercatid"]) ."&commentsuccess=1");
		} else if ($_POST["commenttype"] == COMMENT_DOWNLOADS) {
			header("location: index.php?_m=downloads&_a=viewdownload&downloaditemid=". intval($_POST["typeid"]) ."&commentsuccess=1");
		} else if ($_POST["commenttype"] == COMMENT_NEWS) {
			header("location: index.php?_m=news&_a=viewnews&newsid=". intval($_POST["typeid"]) ."&commentsuccess=1");
		}
	}
}
?>